﻿using Net5ApiAndEfMySql.DtoModel;
using Net5ApiAndEfMySql.Repository;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VueAndNetCoreEfApi.IRepository.SystemAdmin;
using VueAndNetCoreEfApi.IService.SystemAdmin;
using VueAndNetCoreEfApi.PoModel.departmentyrh;

namespace VueAndNetCoreEfApi.Service.SystemAdmin
{
    public class departmentService : BaseRepository, IdepartmentService
    {
        private IdepartmentRespository _idepartmentRespository;
        public departmentService(IdepartmentRespository idepartmentRespository)
        {
            _idepartmentRespository = idepartmentRespository;
        }
        /// <summary>
        /// 部门管理显示分页
        /// </summary>
        /// <param name="sm"></param>
        /// <returns></returns>
        public PagerResult<department> GetdepartmentList(SearchModel sm)
        {
            return _idepartmentRespository.GetdepartmentList(sm);
        }
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public bool departmentAdd(department user)
        {
            user.dp_createtime = DateTime.Now;
            return _idepartmentRespository.departmentAdd(user);
        }
        /// <summary>
        /// 部门管理删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool departmentDelete(int id)
        {
            return _idepartmentRespository.departmentDelete(id);
        }
        /// <summary>
        /// 反填
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public department departmentFantian(int id)
        {
            return _idepartmentRespository.departmentFantian(id);
        }
        public bool departmentUpdate(department user)
        {
            user.dp_createtime = DateTime.Now;
            return _idepartmentRespository.departmentUpdate(user);
        }
        }
}
